<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>jouyouyun&#39;s blog</title>
  <meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>

<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta name="theme-color" content="#f8f5ec" />
<meta name="msapplication-navbutton-color" content="#f8f5ec">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#f8f5ec">


<meta name="author" content="jouyouyun" /><meta name="description" content="jouyouyun&#39;s blog" /><meta name="keywords" content="jouyouyun, Hugo, theme, even" />






<meta name="generator" content="Hugo 0.54.0 with even 4.0.0" />


<link rel="canonical" href="https://jouyouyun.github.io/" />
  <link href="https://jouyouyun.github.io/index.xml" rel="alternate" type="application/rss+xml" title="jouyouyun&#39;s blog" />
  <link href="https://jouyouyun.github.io/index.xml" rel="feed" type="application/rss+xml" title="jouyouyun&#39;s blog" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">


<link href="/dist/even.93844dae.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.css" integrity="sha256-7TyXnr2YU040zfSP+rEcz29ggW4j56/ujTPwjMzyqFY=" crossorigin="anonymous">


<meta property="og:title" content="jouyouyun&#39;s blog" />
<meta property="og:description" content="jouyouyun&#39;s blog" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://jouyouyun.github.io/" />

<meta property="og:updated_time" content="2019-04-11T14:49:00&#43;08:00"/>

<meta itemprop="name" content="jouyouyun&#39;s blog">
<meta itemprop="description" content="jouyouyun&#39;s blog">

<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="jouyouyun&#39;s blog"/>
<meta name="twitter:description" content="jouyouyun&#39;s blog"/>

<!--[if lte IE 9]>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
<![endif]-->

<!--[if lt IE 9]>
  <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->

</head>
<body>
  <div id="mobile-navbar" class="mobile-navbar">
  <div class="mobile-header-logo">
    <a href="/" class="logo">jouyouyun</a>
  </div>
  <div class="mobile-navbar-icon">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>
<nav id="mobile-menu" class="mobile-menu slideout-menu">
  <ul class="mobile-menu-list">
    <a href="/post/">
        <li class="mobile-menu-item">Archives</li>
      </a><a href="/tags/">
        <li class="mobile-menu-item">Tags</li>
      </a><a href="/categories/">
        <li class="mobile-menu-item">Categories</li>
      </a>
  </ul>
</nav>
  <div class="container" id="mobile-panel">
    <header id="header" class="header">
        <div class="logo-wrapper">
  <a href="/" class="logo">jouyouyun</a>
</div>

<nav class="site-navbar">
  <ul id="menu" class="menu">
    <li class="menu-item">
        <a class="menu-item-link" href="/post/">Archives</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/tags/">Tags</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/categories/">Categories</a>
      </li>
  </ul>
</nav>
    </header>

    <main id="main" class="main">
      <div class="content-wrapper">
        <div id="content" class="content">
          <section id="posts" class="posts">
    <article class="post">
  <header class="post-header">
    <h1 class="post-title"><a class="post-link" href="/post/clean_invalid_branch_in_git/">清理无用的 local branch</a></h1>
    <div class="post-meta">
      <span class="post-time"> 2019-04-11 </span>
      <div class="post-category">
          <a href="/categories/blog/"> BLOG </a>
          </div>
    </div>
  </header>
  
  <div class="post-content">
    <div class="post-summary">
      <p>在开发新功能或修复 <code>bug</code> 时, 会从 <code>master</code> 上新建 <code>branch</code> 来处理, 当完成后会将这个 <code>branch</code> 推送到 <code>origin</code> 中, 如:
<code>git push origin &lt;branch name&gt;:&lt;branch name&gt;</code>.</p>

<p><code>origin</code> 审核代码没有问题后就会 <strong>合并分支并删除</strong>, 但 <strong>本地</strong> 在 <code>git pull</code> 删除本地分支后, 仍能通过 <code>git branch -a</code> 看到这个 <code>branch</code> 的 <code>origin ref</code>.
日积月累之下本地就会有很多这样无用的 <code>branch ref</code>, 很是让人厌烦, 遂在此记录清理的方法.</p>
    </div>
    <div class="read-more">
      <a href="/post/clean_invalid_branch_in_git/" class="read-more-link">阅读更多</a>
    </div>
  </div>
</article>

    <article class="post">
  <header class="post-header">
    <h1 class="post-title"><a class="post-link" href="/post/mysql_commands/">MySQL 常用命令</a></h1>
    <div class="post-meta">
      <span class="post-time"> 2019-04-05 </span>
      <div class="post-category">
          <a href="/categories/blog/"> BLOG </a>
          </div>
    </div>
  </header>
  
  <div class="post-content">
    <div class="post-summary">
      <p>大学学的数据库系统概论工作后几年没有使用都已忘了, 现在项目需要用到数据库, 但来不及细看相关书籍了, 遂将一些常用的记录下来.</p>

<h2 id="常用类型">常用类型</h2>

<p><code>MySQL</code> 支持多种类型, 大致可以分为三类: 数值, 日期/时间和字符串(字符)类型, 大致如下:</p>

<ul>
<li><p>数值类型</p>

<ul>
<li>整数: <code>tinyint</code>, <code>smallint</code>, <code>mediumint</code>, <code>int</code>, <code>bigint</code></li>
<li>浮点数: <code>float</code>, <code>double</code>, <code>decimal</code></li>
</ul></li>

<li><p>日期和时间</p>

<p><code>date</code>, <code>time</code>, <code>datetime</code>, <code>timestamp</code>, <code>year</code></p></li>

<li><p>字符串类型</p>

<ul>
<li>字符串: <code>char</code>, <code>varchar</code></li>
<li>文本: <code>tinytext</code>, <code>text</code>, <code>mediumtext</code>, <code>longtext</code></li>
<li>二进制字符串: <code>tinyblob</code>, <code>blob</code>, <code>mediumblob</code>, <code>longblob</code></li>
</ul></li>
</ul>

<p>下面将详细给出每种类型的大小和描述.</p>
    </div>
    <div class="read-more">
      <a href="/post/mysql_commands/" class="read-more-link">阅读更多</a>
    </div>
  </div>
</article>

    <article class="post">
  <header class="post-header">
    <h1 class="post-title"><a class="post-link" href="/post/hugo-github/">使用 hugo 写博客</a></h1>
    <div class="post-meta">
      <span class="post-time"> 2019-02-02 </span>
      <div class="post-category">
          <a href="/categories/blog/"> BLOG </a>
          </div>
    </div>
  </header>
  
  <div class="post-content">
    <div class="post-summary">
      <p><a href="https://github.com/gohugoio/hugo">hugo</a> 是由 <code>Go</code> 语言实现的静态网站生成器, 简单、易用、高效、易扩展、快速部署。</p>

<h2 id="安装">安装</h2>

<p>到 <a href="https://github.com/gohugoio/hugo/releases">Release</a> 下载对应系统的二进制文件压缩包, 然后解压, 并把得到的二进制复制到 <code>Path</code> 中.</p>

<h2 id="简单使用">简单使用</h2>

<h3 id="创建一个站点">创建一个站点</h3>

<p>使用命令 <code>hugo new site &lt;dir&gt;</code> 来创建站点, 创建后的结构如下:</p>
    </div>
    <div class="read-more">
      <a href="/post/hugo-github/" class="read-more-link">阅读更多</a>
    </div>
  </div>
</article>

    <article class="post">
  <header class="post-header">
    <h1 class="post-title"><a class="post-link" href="/post/gorm-association/">gorm 关联查询</a></h1>
    <div class="post-meta">
      <span class="post-time"> 2018-12-05 </span>
      <div class="post-category">
          <a href="/categories/blog/"> BLOG </a>
          </div>
    </div>
  </header>
  
  <div class="post-content">
    <div class="post-summary">
      <p>定义了一个 <code>User</code> 和 <code>Company</code>, <code>User</code> 中可以包含多个 <code>Company</code>, 如下:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code class="language-go" data-lang="go"><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-go" data-lang="go"><span class="kd">type</span> <span class="nx">User</span> <span class="kd">struct</span> <span class="p">{</span>
        <span class="nx">ID</span>        <span class="kt">int</span>        <span class="s">`gorm:&#34;TYPE:int(11);NOT NULL;PRIMARY_KEY;INDEX&#34;`</span>
        <span class="nx">Name</span>      <span class="kt">string</span>     <span class="s">`gorm:&#34;TYPE: VARCHAR(255); DEFAULT:&#39;&#39;;INDEX&#34;`</span>
        <span class="nx">Companies</span> <span class="p">[]</span><span class="nx">Company</span>  <span class="s">`gorm:&#34;FOREIGNKEY:UserId;ASSOCIATION_FOREIGNKEY:ID&#34;`</span>
        <span class="nx">CreatedAt</span> <span class="nx">time</span><span class="p">.</span><span class="nx">Time</span>  <span class="s">`gorm:&#34;TYPE:DATETIME&#34;`</span>
        <span class="nx">UpdatedAt</span> <span class="nx">time</span><span class="p">.</span><span class="nx">Time</span>  <span class="s">`gorm:&#34;TYPE:DATETIME&#34;`</span>
        <span class="nx">DeletedAt</span> <span class="o">*</span><span class="nx">time</span><span class="p">.</span><span class="nx">Time</span> <span class="s">`gorm:&#34;TYPE:DATETIME;DEFAULT:NULL&#34;`</span>
<span class="p">}</span>

<span class="kd">type</span> <span class="nx">Company</span> <span class="kd">struct</span> <span class="p">{</span>
        <span class="nx">gorm</span><span class="p">.</span><span class="nx">Model</span>
        <span class="nx">Industry</span> <span class="kt">int</span>    <span class="s">`gorm:&#34;TYPE:INT(11);DEFAULT:0&#34;`</span>
        <span class="nx">Name</span>     <span class="kt">string</span> <span class="s">`gorm:&#34;TYPE:VARCHAR(255);DEFAULT:&#39;&#39;;INDEX&#34;`</span>
        <span class="nx">Job</span>      <span class="kt">string</span> <span class="s">`gorm:&#34;TYPE:VARCHAR(255);DEFAULT:&#39;&#39;&#34;`</span>
        <span class="nx">UserId</span>   <span class="kt">int</span>    <span class="s">`gorm:&#34;TYPE:int(11);NOT NULL;INDEX&#34;`</span>
<span class="p">}</span></code></pre></td></tr></table>
</div>
</div>
    </div>
    <div class="read-more">
      <a href="/post/gorm-association/" class="read-more-link">阅读更多</a>
    </div>
  </div>
</article>

    <article class="post">
  <header class="post-header">
    <h1 class="post-title"><a class="post-link" href="/post/python-learn-note/">python3 学习笔记</a></h1>
    <div class="post-meta">
      <span class="post-time"> 2018-12-02 </span>
      <div class="post-category">
          <a href="/categories/note/"> NOTE </a>
          </div>
    </div>
  </header>
  
  <div class="post-content">
    <div class="post-summary">
      <h2 id="python3-study-notes">Python3 Study Notes</h2>

<p>本人很少写 <code>python</code> 代码, 一般都是用 <code>go</code> 的, 去年时用 <code>python</code> 写过一些收集系统信息的工具, 当时是边看手册边写的. 如今又要用 <code>python</code> 来写一个生成 <code>xlsx</code> 的工具, 就又需要查看手册了, 至于为什么不用 <code>go</code> 写? 那是因为 <code>go</code> 的库不兼容永中. 在这里不得不说, 虽然 <code>go</code> 很火, 但是一些库还是不如 <code>python</code> 多, 不如 <code>python</code> 兼容性好.</p>

<p>为了避免以后再出这种事情, 这次就好好的了解下 <code>python</code>, 将它的用法按照自己对语言的理解分块记录下来. 要使用某种语言, 个人认为需要了解这些方面:</p>

<ul>
<li>编码风格</li>
<li>变量的类型, 声明及使用方式</li>
<li>输入/输出</li>
<li>控制语句的写法</li>
<li>错误处理的用法</li>
<li>函数的用法, 还有语言支持的一些特性, <code>python</code> 中就有装饰器, <code>lambda</code> 语句等</li>
<li>对于面向对象语言还需要了解类的声明, 继承, 多态等的用法</li>
</ul>

<p>还有一些就是此语言的一些特性, <code>python</code> 就还需要了解以下特性:</p>
    </div>
    <div class="read-more">
      <a href="/post/python-learn-note/" class="read-more-link">阅读更多</a>
    </div>
  </div>
</article>

    </section>
  
  <nav class="pagination">
    <a class="prev" href="/page/2/">
        <i class="iconfont icon-left"></i>
        <span class="prev-text">上一页</span>
      </a>
    <a class="next" href="/page/4/">
        <span class="next-text">下一页</span>
        <i class="iconfont icon-right"></i>
      </a>
  </nav>
        </div>
        

      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="social-links">
      <a href="mailto:jouyouwen717@gmail.com" class="iconfont icon-email" title="email"></a>
      <a href="https://twitter.com/jouyouyun" class="iconfont icon-twitter" title="twitter"></a>
      <a href="https://github.com/jouyouyun" class="iconfont icon-github" title="github"></a>
  <a href="https://jouyouyun.github.io/index.xml" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a>
</div>

<div class="copyright">
  <span class="power-by">
    由 <a class="hexo-link" href="https://gohugo.io">Hugo</a> 强力驱动
  </span>
  <span class="division">|</span>
  <span class="theme-info">
    主题 - 
    <a class="theme-link" href="https://github.com/olOwOlo/hugo-theme-even">Even</a>
  </span>

  

  <span class="copyright-year">
    &copy; 
    2014 - 
    2019
    <span class="heart">
      <i class="iconfont icon-heart"></i>
    </span>
    <span class="author">jouyouyun</span>
  </span>
</div>
    </footer>

    <div class="back-to-top" id="back-to-top">
      <i class="iconfont icon-up"></i>
    </div>
  </div>
  
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/slideout@1.0.1/dist/slideout.min.js" integrity="sha256-t+zJ/g8/KXIJMjSVQdnibt4dlaDxc9zXr/9oNPeWqdg=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.js" integrity="sha256-XVLffZaxoWfGUEbdzuLi7pwaUJv1cecsQJQqGLe7axY=" crossorigin="anonymous"></script>
<script type="text/javascript" src="/dist/even.ece58db6.min.js"></script>








</body>
</html>
